#!/bin/bash
CONFIG_NAME=$1;SCRIPT_DIR=$(dirname "$0");TARGET_FILE=$SCRIPT_DIR/../../demo/vendor/common/common/build_config.h;if [ -f "$TARGET_FILE" ]; then CURRENT_CONFIG=$(grep -oP 'CURRENT_BUILD_\K\w+(?=\s*1//Compile option name)' "$TARGET_FILE" || echo ""); else CURRENT_CONFIG=""; fi;if [ "$CURRENT_CONFIG" != "$CONFIG_NAME" ]; then echo '/********************************************************************************************************
 * @file    build_config.h
 *
 * @brief   This is the source file for Telink RISC-V MCU
 *
 * @author  Driver Group
 * @date    2025
 *
 * @par     Copyright (c) 2025, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
 *
 *          Licensed under the Apache License, Version 2.0 (the "License");
 *          you may not use this file except in compliance with the License.
 *          You may obtain a copy of the License at
 *
 *              http://www.apache.org/licenses/LICENSE-2.0
 *
 *          Unless required by applicable law or agreed to in writing, software
 *          distributed under the License is distributed on an "AS IS" BASIS,
 *          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *          See the License for the specific language governing permissions and
 *          limitations under the License.
 *
 *******************************************************************************************************/
 
/* Auto-generated by build script */
#ifndef BUILD_CONFIG_H
#define BUILD_CONFIG_H

#define CURRENT_BUILD_'$CONFIG_NAME'       1//Compile option name
#endif' > "$TARGET_FILE"; echo "Updated build_config.h with new config: $CONFIG_NAME"; else echo "build_config.h already contains current config: $CONFIG_NAME, no update needed"; fi